class Solution {
    public:
        vector<int> dailyTemperatures(vector<int>& par) {
            stack<int>st; 
            vector<int>res(par.size());
            for(int i=par.size()-1;i>=0;--i){
                while(st.size()&&par[st.top()]<=par[i])st.pop();
                if(st.empty())res[i]=0;
                else res[i]=st.top()-i;
                st.push(i);
            }
            return res; 
        }
    };